﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.pp.processor.type.comm;
using SharpSqlAnalyzer.pp.utils;
using SharpSqlAnalyzer.stmt;

namespace SharpSqlAnalyzer.pp.processor.type.plsql
{
	// Token: 0x02000238 RID: 568
	public class CreateFuncWSPaddingParenthesesProcessor : AbstractProcessor
	{
		// Token: 0x060012DD RID: 4829 RVA: 0x0031B248 File Offset: 0x00319448
		public override void process(TParseTreeNode nodeArg)
		{
			TStoredProcedureSqlStatement tstoredProcedureSqlStatement = nodeArg as TStoredProcedureSqlStatement;
			if (tstoredProcedureSqlStatement.ParameterDeclarations == null || tstoredProcedureSqlStatement.ParameterDeclarations.size() == 0)
			{
				return;
			}
			TSourceToken tsourceToken = SourceTokenSearcher.backforwardSearch(tstoredProcedureSqlStatement.ParameterDeclarations.startToken, 5, "(");
			TSourceToken tsourceToken2 = SourceTokenSearcher.forwardSearch(tstoredProcedureSqlStatement.ParameterDeclarations.endToken, 5, ")");
			if (tsourceToken == null || tsourceToken2 == null)
			{
				return;
			}
			SourceTokenOperator.removeWhitespaceAndReturnFromStart(this.Option, tsourceToken.container, tsourceToken.posinlist + 1);
			if (this.Option.wsPaddingParenthesesInFunction)
			{
				SourceTokenOperator.addAfter(this.Option, tsourceToken, SourceTokenOperator.createWhitespaceSourceToken(1));
			}
			SourceTokenOperator.removeWhitespaceAndReturnFromEnd(this.Option, tsourceToken2);
			if (this.Option.wsPaddingParenthesesInFunction)
			{
				SourceTokenOperator.addBefore(this.Option, tsourceToken2, SourceTokenOperator.createWhitespaceSourceToken(1));
			}
		}
	}
}
